package com.cmic.rcs.emoji.mapper;

import com.cmic.rcs.emoji.entity.pojo.TEnterpriseMember;
import io.mybatis.mapper.Mapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface TEnterpriseMemberMapper extends Mapper<TEnterpriseMember,Long> {
    @Delete("delete from t_enterprise_member where enterprise_code = #{enterpriseCode}")
    int deleteByEnterpriseCode(String enterpriseCode);

    @Select("select * from t_enterprise_member where member_account = #{encryptedPhone}")
    TEnterpriseMember selectByEncryptedPhone(String encryptedPhone);

    @Update("update t_enterprise_member set last_app_login_time = #{lastAppLoginTime}, app_login_count = #{appLoginCount} where id = #{id}")
    void updateById(TEnterpriseMember member);

    @Select("select * from t_enterprise_member where enterprise_code = #{enterpriseCode}")
    List<TEnterpriseMember> selectListAll(String enterpriseCode);

    @Select("select * from t_enterprise_member where member_account = #{phoneNumber}")
    List<TEnterpriseMember> selectListbyPhone(String phoneNumber);

    @Insert("insert into t_enterprise_member (enterprise_code, member_account, member_name, member_status, create_time, update_time, create_by) values (#{enterpriseCode}, #{memberAccount}, #{memberName}, #{memberStatus}, #{createTime}, #{updateTime}, #{createBy})")
    void insertOne(TEnterpriseMember member);
}
